package ncme.auto.framework.core.entities.config;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;

import java.util.ArrayList;
import java.util.List;

@PropertySource(value = "classpath:application.yml", ignoreResourceNotFound = true)
@Component
@ConfigurationProperties(prefix = "interceptor-config")
public class InterceptorConfigBean {

    private String excludePath;

    public InterceptorConfigBean() {
    }

    public String getExcludePath() {
        return excludePath;
    }

    public void setExcludePath(String excludePath) {
        this.excludePath = excludePath;
    }

    public List<String> getPatterns(){
        List<String> li = new ArrayList<>();
        li.addAll(StringUtils.commaDelimitedListToSet(this.excludePath));
        return li;
    }
}
